package com.dc.trans.steps.bwzh;

import java.awt.Graphics;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;

import javax.swing.JScrollBar;
import javax.swing.JScrollPane;

public class MappingScrollPanel extends JScrollPane
{

	MappingScrollPanel(MappedPanel mapp)
	{
		super();
		this.mapp = mapp;
		JScrollBar bar = this.getVerticalScrollBar(); //   返回控制视口垂直视图位置的垂直滚动条 
		bar.addAdjustmentListener(new AdjustmentListener()
		{

			public void adjustmentValueChanged(AdjustmentEvent e)
			{
				adjustmentValueChanged1(e);

			}

		}); //   监听滚

		JScrollBar bar1 = this.getHorizontalScrollBar(); //   返回控制视口垂直视图位置的垂直滚动条 
		bar1.addAdjustmentListener(new AdjustmentListener()
		{

			public void adjustmentValueChanged(AdjustmentEvent e)
			{
				adjustmentValueChanged1(e);

			}

		}); //   监听滚

	}

	public void adjustmentValueChanged1(AdjustmentEvent e)
	{
		if (mapp != null)
		{
			mapp.repaint();

		}

	}

	private MappedPanel mapp = null;

	public void paint(Graphics g)
	{
		super.paint(g);
	}

	public MappedPanel getMapp()
	{
		return mapp;
	}

	public void setMapp(MappedPanel mapp)
	{
		this.mapp = mapp;
	}

}
